/**
 * @description: 管理员帐号
 */
import { defHttp } from '../http'
import type { CommonAPI } from '../schema/all'
/** 获取帐号信息 */
export const getAdminApiAccountDetailApi: CommonAPI<
  '/admin/api/account',
  'get'
> = (params) => defHttp.get(`/admin/api/account`, { params })

/** 更新帐号信息 */
export const updateAdminApiAccountApi: CommonAPI<
  '/admin/api/account',
  'post'
> = (data) => defHttp.post(`/admin/api/account`, { data })

/** 修改帐号密码 */
export const updateAdminApiAccountPasswordApi: CommonAPI<
  '/admin/api/account/password',
  'post'
> = (data) => defHttp.post(`/admin/api/account/password`, { data })

/** 获取图片验证码 */
export const getAdminApiCaptchaImageApi: CommonAPI<
  '/admin/api/captcha/image',
  'get'
> = (params) =>
  defHttp.get(
    `/admin/api/captcha/image`,
    { params },
    {
      isTransformResponse: false
    }
  )

/** 检查是否需要验证码 */
export const getAdminApiCaptchaPreCheckApi: CommonAPI<
  '/admin/api/captcha/pre-check',
  'get'
> = (params) => defHttp.get(`/admin/api/captcha/pre-check`, { params })

/** 验证图片验证码 */
export const postAdminApiCaptchaVerifyApi: CommonAPI<
  '/admin/api/captcha/verify',
  'post'
> = (data) =>
  defHttp.post(
    `/admin/api/captcha/verify`,
    { data },
    {
      isTransformResponse: false
    }
  )

/** 登录 */
export const postAdminApiLoginApi: CommonAPI<'/admin/api/login', 'post'> = (
  data
) =>
  defHttp.post(
    `/admin/api/login`,
    { data },
    {
      isTransformResponse: false
    }
  )
